<div id="user-div" ng-controller="userCtrl">
  <div class="well with-header  with-footer">
    <div class="header">系统用户表</div>
    <table  class="table table-striped table-hover table-bordered" id="editabledatatable">
        <thead>
            <tr user="row">
                <th class="name">账号</th>
                <th class="name">真实姓名</th>
                <th class="name">所属公司</th>
                <th class="name">邮箱</th>
                <th class="name">联系电话</th>
                <th class="privilege">角色</th>
                <th class="edit">    </th>
            </tr>
        </thead>
        <tbody id="user-distribution" >
            <tr ng-repeat="user in users" key={{user.userId}}>
                <td class="name">
                  <span >{{user.account}}</span>
                </td>
                <td> {{user.userName}} </td>
                <td> {{user.companyName}} </td>
                <td> {{user.email}} </td>
                <td> {{user.phone}} </td>
                <td class="privilege">
                  <div ng-if="!user.editActive">{{user.type | userType}}</div>
                  <select ng-model="user.userTypeNum" ng-if="user.editActive">
                    <option value="0">普通管理员</option>
                    <option value="1">超级管理员</option>
                  </select>
                </td>
                <td class="edit">
                    <a ng-if="!user.editActive" class="btn btn-info btn-xs updateuser edit " key={{user.userId}} ng-click="updateUser($index,user.userId)"><i class="fa fa-edit"></i> 修改</a>
                    <a ng-if="!user.editActive" class="btn btn-danger btn-xs delete" ng-click="deleteUser(user.userId)"><i class="fa fa-trash-o"></i> 删除</a>
                    <a ng-if="user.editActive"  ng-click="sureUpdateUser($index,user.userId)" class="btn btn-success btn-xs save"><i class="fa fa-save"></i> 确认</a>
                    <a ng-if="user.editActive"  ng-click="updateUser($index,user.userId)" class="btn btn-warning btn-xs cancel"><i class="fa fa-times"></i> 取消</a>
                </td>
            </tr>
        </tbody>
    </table>

    <pagination current-page="currentPage" total-page="totalPage" get-record="getRecord()">
    </pagination>
  </div>
  <!-- 删除确认弹框 -->
  <div class="modal-preview "  ng-class="showModal?'show':'noshow'">
    <div class="modal modal-primary">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" ng-click="deleteUser()" data-dismiss="modal" aria-hidden="true">×</button>
            <h4 class="modal-title">删除用户</h4>
          </div>
          <div class="modal-body">
            <p>确认删除此用户？</p>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-warning" data-dismiss="modal" ng-click="deleteUser()">取消</button>
            <button type="button" class="btn btn-primary" ng-click="sureDeleteUser()">确认</button>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="mask" ng-if="showModal"></div>
  <div class="clear"></div>
</div>
<script>
$(function() {
  $( ".modal-preview" ).draggable();
});
</script>
